package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the affix database table.
 * 
 */
@Entity
@NamedQuery(name="Affix.findAll", query="SELECT a FROM Affix a")
public class Affix implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="affix_id")
	private int affixId;

	@Temporal(TemporalType.DATE)
	@Column(name="affix_date")
	private Date affixDate;

	@Column(name="affix_name")
	private String affixName;

	@Column(name="affix_stage")
	private int affixStage;

	//bi-directional many-to-one association to Dictionary
	@ManyToOne
	@JoinColumn(name="affix_state")
	private Dictionary dictionary;

	//bi-directional many-to-one association to Customer
	@OneToMany(mappedBy="affix")
	private List<Customer> customers;

	//bi-directional many-to-one association to Demand
	@OneToMany(mappedBy="affix")
	private List<Demand> demands;


	//bi-directional many-to-one association to Solution
	@OneToMany(mappedBy="affix")
	private List<Solution> solutions;

	public Affix() {
	}

	public int getAffixId() {
		return this.affixId;
	}

	public void setAffixId(int affixId) {
		this.affixId = affixId;
	}

	public Date getAffixDate() {
		return this.affixDate;
	}

	public void setAffixDate(Date affixDate) {
		this.affixDate = affixDate;
	}

	public String getAffixName() {
		return this.affixName;
	}

	public void setAffixName(String affixName) {
		this.affixName = affixName;
	}

	public int getAffixStage() {
		return this.affixStage;
	}

	public void setAffixStage(int affixStage) {
		this.affixStage = affixStage;
	}

	public Dictionary getDictionary() {
		return this.dictionary;
	}

	public void setDictionary(Dictionary dictionary) {
		this.dictionary = dictionary;
	}

	public List<Customer> getCustomers() {
		return this.customers;
	}

	public void setCustomers(List<Customer> customers) {
		this.customers = customers;
	}

	public Customer addCustomer(Customer customer) {
		getCustomers().add(customer);
		customer.setAffix(this);

		return customer;
	}

	public Customer removeCustomer(Customer customer) {
		getCustomers().remove(customer);
		customer.setAffix(null);

		return customer;
	}

	public List<Demand> getDemands() {
		return this.demands;
	}

	public void setDemands(List<Demand> demands) {
		this.demands = demands;
	}

	public Demand addDemand(Demand demand) {
		getDemands().add(demand);
		demand.setAffix(this);

		return demand;
	}

	public Demand removeDemand(Demand demand) {
		getDemands().remove(demand);
		demand.setAffix(null);

		return demand;
	}

	public List<Solution> getSolutions() {
		return this.solutions;
	}

	public void setSolutions(List<Solution> solutions) {
		this.solutions = solutions;
	}

	public Solution addSolution(Solution solution) {
		getSolutions().add(solution);
		solution.setAffix(this);

		return solution;
	}

	public Solution removeSolution(Solution solution) {
		getSolutions().remove(solution);
		solution.setAffix(null);

		return solution;
	}

}